<template>
  <div>
    <!-- 搜索框 -->
    <van-search v-model="value" shape="round" placeholder="请输入搜索关键词" />

    <!-- 轮播图 -->
    <Swiple :bannerArr="bannerArr"></Swiple>

    <!-- Grid导航 -->
    <Grid :channelArr="channelArr"></Grid>

    <!-- ProductList产品列表 -->
    <ProductList :brandListArr="brandListArr"></ProductList>
    <NewGoods :newGoodsListArr="newGoodsListArr"></NewGoods>
    <HotGoods :hotGoodsListArr="hotGoodsListArr"></HotGoods>
    <TopicList :topicListArr="topicListArr"></TopicList>
  </div>
</template>

<script>
// 引入数据请求
import { getIndexData } from "@/utils/http.js";

//引入轮播图组件
import Swiple from "@/components/Swiple.vue";

//引入grid导航组件
import Grid from "@/components/Grid.vue";

//引入--品牌制造商直供--产品列表导航组件
import ProductList from "@/components/ProductList.vue";
//引入--人气产品--产品列表导航组件
import HotGoods from "@/components/HotGoods.vue";
//引入--新品首发--产品列表导航组件
import NewGoods from "@/components/NewGoods.vue";
//引入--专题产品--产品列表导航组件
import TopicList from "@/components/TopicList.vue";

export default {
  methods: {
    toSearch() {
      // console.log(this);
      this.$route.pash("/search");
    },
  },
  data() {
    return {
      value: "",
      bannerArr: [],
      channelArr: [],
      brandListArr: [],
      hotGoodsListArr: [],
      topicListArr: [],
      newGoodsListArr: [],
    };
  },
  components: {
    Swiple,
    Grid,
    ProductList,
    HotGoods,
    NewGoods,
    TopicList,
  },

  created() {
    getIndexData().then((res) => {
      // console.log(res.data);

      this.bannerArr = res.data.data.banner;
      this.channelArr = res.data.data.channel;
      this.brandListArr = res.data.data.brandList;
      this.hotGoodsListArr = res.data.data.hotGoodsList;
      this.topicListArr = res.data.data.topicList;
      this.newGoodsListArr = res.data.data.newGoodsList;
    });
  },
};
</script>

<style lang='less'>
.my-swipe .van-swipe-item {
  color: #fff;

  font-size: 20px;
  line-height: 150px;
  text-align: center;
  background-color: #39a9ed;
}
.van-swipe-item img {
  width: 100%;
}
</style>